<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>onclick</title>
	</head>

	<body>
		<div class="onClick">onclick 点击</div>
		<div class="add">addEventListener 点击</div>

		<script>
			const onClick = document.querySelector('.onClick')
			const add = document.querySelector('.add')

			onClick.onclick = function () {
				console.log('onclick - 1')
			}
			onClick.onclick = function () {
				console.log('onclick - 2')
			}

			add.addEventListener('click', function () {
				onClick.onclick = null
				console.log('add - 1')
			})
			add.addEventListener('click', function () {
				console.log('add - 2')
			})
		</script>
	</body>
</html>
